<?php

set_include_path('.'. PATH_SEPARATOR .'../application/models/'
                    . PATH_SEPARATOR .'../library'
                    . PATH_SEPARATOR . get_include_path());
include "Zend/Loader.php";
Zend_Loader::loadClass('Zend_Controller_Front');
Zend_Loader::loadClass('Zend_Controller_Plugin_ErrorHandler');
Zend_Loader::loadClass('Zend_Config_Ini');
Zend_Loader::loadClass('Zend_Registry');
Zend_Loader::loadClass('Zend_Db');
Zend_Loader::loadClass('Zend_Db_Table');
Zend_Loader::loadClass('Zend_Auth');

// load configuration
$config = new Zend_Config_Ini('../application/config.ini', 'general');
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);

// setup database
$db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
Zend_Db_Table::setDefaultAdapter($db);
$registry->set('db', $db);

// setup message system
Zend_Loader::loadClass('Message');

//Initialize sessions
Zend_Loader::loadClass('Zend_Session');
Zend_Session::start();

//setup controller
$fontController = Zend_Controller_Front::getInstance();
$fontController->registerPlugin(new Zend_Controller_Plugin_ErrorHandler());
$fontController->throwExceptions(true);
$fontController->setControllerDirectory('../application/controllers');


//run!
$fontController->dispatch();


?>
